// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 

package pica.ui;

import c;
import java.io.PrintStream;
import java.util.Vector;
import javax.microedition.lcdui.*;

// Referenced classes of package pica.ui:
//            b, a, f, h

public final class g extends b
    implements CommandListener
{

    public g(h h1, String s1, int i1, int j1, int k1, int l1)
    {
        super(h1, s1);
        z = 0;
        B = Font.getFont(0, 0, 8);
        D = 0xffffff;
        E = null;
        H = false;
        I = 5;
        super.e = i1;
        super.f = j1;
        o = i1;
        p = j1;
        super.g = k1;
        l = l1;
        m = l1;
        n = k1;
        y = 0;
        x = -1;
        w = new Vector();
        F = 1;
        z = 0;
        try
        {
            if(i == null)
                i = Image.createImage("/middle/arrow.png");
            return;
        }
        catch(Exception _ex)
        {
            return;
        }
    }

    protected final synchronized void a(Graphics g1)
    {
        g1.setFont(B);
        l();
        int i1 = g1.getClipX();
        int j1 = g1.getClipY();
        int k1 = g1.getClipWidth();
        int l1 = g1.getClipHeight();
        g1.setClip(o, p, n, l);
        b(g1);
        y = -1;
        if(w == null)
            return;
        for(int i2 = 0; i2 < w.size(); i2++)
        {
            Object aobj[] = (Object[])w.elementAt(i2);
            if(i2 == x)
                aobj[8] = new Boolean(true);
            else
                aobj[8] = new Boolean(false);
            if(((Integer)aobj[5]).intValue() + (((Integer)aobj[7]).intValue() - 1) * (((Integer)aobj[2]).intValue() + j) <= p - super.f || ((Integer)aobj[5]).intValue() >= (p - super.f) + l + ((Integer)aobj[2]).intValue())
                continue;
            if(((Boolean)aobj[6]).booleanValue())
                y = y != -1 ? y : i2;
            a(g1, aobj);
        }

        if(z < 0)
        {
            super.f = super.f - (Math.abs(z) <= A ? Math.abs(z) : A);
            z = z + A;
            if(z > 0)
                z = 0;
            if(super.f < -(super.h - l - p))
            {
                super.f = -(super.h - l - p);
                z = 0;
            }
        } else
        if(z > 0)
        {
            super.f = super.f + (z <= A ? z : A);
            z = z - A;
            if(z < 0)
                z = 0;
            if(super.f > p)
            {
                super.f = p;
                z = 0;
            }
        }
        a(g1, K);
        g1.setClip(i1, j1, k1, l1);
        if(H)
        {
            if(I == 0)
            {
                a((byte)0, G);
                return;
            }
            I--;
        }
    }

    private void l()
    {
        if(F == 1)
            return;
        if(!h.g)
        {
            super.e = q;
            super.f = r;
            o = s;
            p = t;
            n = super.g;
            l = m;
            F = 1;
            return;
        }
        switch(F)
        {
        case 2: // '\002'
            if(n < super.g)
            {
                n = n + 4 * A <= super.g ? n + 4 * A : super.g;
                super.e = super.e + 4 * A <= 0 ? super.e + 4 * A : 0;
                return;
            } else
            {
                F = 1;
                return;
            }

        case 3: // '\003'
            if(super.e > q || super.f > r)
            {
                o = o - 2 * A >= s ? o - 2 * A : s;
                super.e = super.e - 2 * A >= q ? super.e - 2 * A : q;
                p = p - 2 * A >= t ? p - 2 * A : t;
                super.f = super.f - 2 * A >= r ? super.f - 2 * A : r;
                n = n + 4 * A <= super.g ? n + 4 * A : super.g;
                l = l + 4 * A <= m ? l + 4 * A : m;
                return;
            }
            F = 1;
            break;
        }
    }

    public final void a(int i1)
    {
        D = i1;
    }

    public final void a(Image image, int i1, int j1)
    {
        E = image;
        u = i1;
        v = j1;
    }

    public final void a(byte byte0)
    {
        switch(byte0)
        {
        case 2: // '\002'
            super.e = -super.g + 1;
            o = 0;
            n = 1;
            F = byte0;
            return;

        case 3: // '\003'
            q = super.e;
            r = super.f;
            s = o;
            t = p;
            m = l;
            super.e += super.g / 2 - 1;
            super.f += m / 2 - 1;
            o += super.g / 2 - 1;
            p += m / 2 - 1;
            n = 2;
            l = 2;
            F = byte0;
            break;
        }
    }

    public final String b(int i1)
    {
        byte byte0;
        if((byte0 = ((Byte)((Object[])w.elementAt(i1))[0]).byteValue()) == 6 || byte0 == 7)
        {
            if((String)((Object[])w.elementAt(i1))[16] != null)
                return (String)((Object[])w.elementAt(i1))[16];
            if((String)((Object[])w.elementAt(i1))[12] != null)
                return (String)((Object[])w.elementAt(i1))[12];
        }
        return null;
    }

    public final int c(int i1)
    {
        byte byte0;
        if((byte0 = ((Byte)((Object[])w.elementAt(i1))[0]).byteValue()) == 7)
            return ((List)((Object[])w.elementAt(i1))[17]).getSelectedIndex();
        else
            throw new IllegalArgumentException("\u6240\u6307\u5B9A\u7684\u5143\u7D20\u4E0D\u662F\u4E0B\u62C9\u5217\u8868\u6846\uFF01");
    }

    public final boolean d(int i1)
    {
        byte byte0;
        if((byte0 = ((Byte)((Object[])w.elementAt(i1))[0]).byteValue()) == 8)
            return ((Boolean)((Object[])w.elementAt(i1))[17]).booleanValue();
        else
            throw new IllegalArgumentException("\u6240\u6307\u5B9A\u7684\u5143\u7D20\u4E0D\u662F\u590D\u9009\u6846\uFF01");
    }

    private void b(Graphics g1)
    {
        g1.setColor(D);
        g1.fillRect(o, p, n, l);
        if(E != null)
            g1.drawImage(E, u - o, v - p, 20);
    }

    private void a(Graphics g1, Object aobj[])
    {
        switch(((Byte)aobj[0]).byteValue())
        {
        case 1: // '\001'
            b(g1, aobj);
            return;

        case 2: // '\002'
            c(g1, aobj);
            return;

        case 3: // '\003'
            f(g1, aobj);
            return;

        case 4: // '\004'
            e(g1, aobj);
            return;

        case 5: // '\005'
            return;

        case 6: // '\006'
            g(g1, aobj);
            return;

        case 7: // '\007'
            h(g1, aobj);
            return;

        case 8: // '\b'
            i(g1, aobj);
            return;

        case 9: // '\t'
            j(g1, aobj);
            return;

        case 16: // '\020'
            k(g1, aobj);
            // fall through

        case 10: // '\n'
        case 11: // '\013'
        case 12: // '\f'
        case 13: // '\r'
        case 14: // '\016'
        case 15: // '\017'
        case 17: // '\021'
        default:
            return;
        }
    }

    private void b(Graphics g1, Object aobj[])
    {
        g1.setColor(((Integer)aobj[10]).intValue());
        if(((Boolean)aobj[6]).booleanValue())
        {
            g1.drawString((String)aobj[11], ((Integer)aobj[4]).intValue() + super.e, ((Integer)aobj[5]).intValue() + super.f, 36);
            return;
        } else
        {
            d(g1, aobj);
            return;
        }
    }

    private void c(Graphics g1, Object aobj[])
    {
        int i1 = ((Integer)aobj[4]).intValue();
        int j1 = ((Integer)aobj[5]).intValue();
        ((Integer)aobj[2]).intValue();
        g1.setColor(((Integer)aobj[10]).intValue());
        if(((Boolean)aobj[6]).booleanValue())
        {
            if(((Boolean)aobj[8]).booleanValue())
            {
                pica.ui.f.a((String)aobj[11], i1 + super.e, j1 + super.f, 0xac2a0a, -1, 36, g1);
                return;
            } else
            {
                g1.drawString((String)aobj[11], i1 + super.e, j1 + super.f, 36);
                return;
            }
        } else
        {
            d(g1, aobj);
            return;
        }
    }

    private void d(Graphics g1, Object aobj[])
    {
        int i1 = ((Integer)aobj[4]).intValue();
        int j1 = ((Integer)aobj[5]).intValue();
        String as[] = (String[])aobj[11];
        int k1 = ((Integer)aobj[2]).intValue();
        for(int l1 = 0; l1 < as.length; l1++)
        {
            if(j1 > p - super.f && j1 - k1 < (p - super.f) + l)
                if(((Boolean)aobj[8]).booleanValue() && ((Byte)aobj[0]).byteValue() == 2)
                {
                    pica.ui.f.a(as[l1], i1 + super.e, j1 + super.f, 0xac2a0a, -1, 36, g1);
                } else
                {
                    g1.setColor(((Integer)aobj[10]).intValue());
                    g1.drawString(as[l1], i1 + super.e, j1 + super.f, 36);
                }
            j1 = j1 + k1 + j;
        }

    }

    private void e(Graphics g1, Object aobj[])
    {
        int i1 = ((Integer)aobj[4]).intValue();
        int j1 = ((Integer)aobj[5]).intValue();
        int k1 = ((Integer)aobj[2]).intValue();
        int l1 = ((Integer)aobj[3]).intValue();
        g1.setColor(((Integer)aobj[10]).intValue());
        g1.drawLine(i1 + super.e, (j1 + super.f) - k1 / 2, (i1 + super.e + l1) - 2 * k - k1 / 2, (j1 + super.f) - k1 / 2);
    }

    private void f(Graphics g1, Object aobj[])
    {
        int i1 = ((Integer)aobj[4]).intValue();
        int j1 = ((Integer)aobj[5]).intValue();
        Image image;
        if((image = (Image)aobj[11]) == null)
        {
            return;
        } else
        {
            g1.drawImage(image, i1 + super.e, j1 + super.f, 36);
            return;
        }
    }

    private void g(Graphics g1, Object aobj[])
    {
        int i1 = ((Integer)aobj[4]).intValue();
        int j1 = ((Integer)aobj[5]).intValue();
        int k1 = ((Integer)aobj[2]).intValue();
        ((Integer)aobj[3]).intValue();
        int l1 = ((Integer)aobj[13]).intValue();
        boolean flag = ((Boolean)aobj[8]).booleanValue();
        String s1 = (String)aobj[11];
        String s2 = (String)aobj[12];
        int i2 = i1 + super.e;
        int j2 = j1 + super.f;
        g1.setColor(((Integer)aobj[10]).intValue());
        g1.drawString(s1, i2, j2 - 2, 36);
        int k2;
        if(s1.length() == 0)
            k2 = 0;
        else
            k2 = B.stringWidth(s1) + 5;
        if(!((Boolean)aobj[6]).booleanValue())
            j2 += k1;
        else
            i2 += k2;
        g1.setColor(250, 250, 250);
        g1.fillRect(i2, j2 - k1, l1, k1);
        g1.setColor(0, 0, 0);
        g1.setClip(i2, j2 - k1, l1, k1);
        if((((Integer)aobj[18]).intValue() & 0x10000) > 0)
        {
            StringBuffer stringbuffer = new StringBuffer();
            for(int l2 = 0; l2 < s2.length(); l2++)
                stringbuffer.append('*');

            g1.drawString(stringbuffer.toString(), i2 + 2, j2 - 2, 36);
        } else
        {
            g1.drawString(s2, i2 + 2, j2 - 2, 36);
        }
        g1.setClip(o, p, n, l);
        a(g1, i2, j2 - k1, l1, k1, ((Byte)aobj[0]).byteValue(), flag);
    }

    private void h(Graphics g1, Object aobj[])
    {
        int i1 = ((Integer)aobj[4]).intValue();
        int j1 = ((Integer)aobj[5]).intValue();
        int k1 = ((Integer)aobj[2]).intValue();
        ((Integer)aobj[3]).intValue();
        int l1 = ((Integer)aobj[13]).intValue();
        boolean flag = ((Boolean)aobj[8]).booleanValue();
        String s1 = (String)aobj[11];
        List list = (List)aobj[17];
        int i2 = i1 + super.e;
        int j2 = j1 + super.f;
        g1.setColor(((Integer)aobj[10]).intValue());
        g1.drawString(s1, i2, j2 - 2, 36);
        int k2;
        if(s1.length() == 0)
            k2 = 0;
        else
            k2 = B.stringWidth(s1) + 5;
        if(!((Boolean)aobj[6]).booleanValue())
            j2 += k1;
        else
            i2 += k2;
        g1.setColor(250, 250, 250);
        g1.fillRect(i2, j2 - k1, l1, k1);
        g1.setColor(0, 0, 0);
        g1.drawString(list.getString(list.getSelectedIndex()).trim(), i2 + 2, j2 - 2, 36);
        a(g1, i2, j2 - k1, l1, k1, ((Byte)aobj[0]).byteValue(), flag);
        g1.drawImage(i, (i2 + l1) - k1 / 2, j2 - k1 / 2, 3);
        if(list.getImage(list.getSelectedIndex()) != null)
            g1.drawImage(list.getImage(list.getSelectedIndex()), i2 + 2, (j2 - k1) + 2, 20);
    }

    private void i(Graphics g1, Object aobj[])
    {
        int i1 = ((Integer)aobj[4]).intValue();
        int j1 = ((Integer)aobj[5]).intValue();
        int k1 = ((Integer)aobj[2]).intValue();
        boolean flag = ((Boolean)aobj[8]).booleanValue();
        int l1 = i1 + super.e;
        int i2;
        int j2 = (i2 = j1 + super.f) - k1 / 2 - 4;
        a(g1, l1, j2, 10, 10, ((Byte)aobj[0]).byteValue(), flag);
        if(((Boolean)aobj[17]).booleanValue())
        {
            g1.setColor(105, 105, 105);
            g1.drawLine(l1 + 3, j2 + 5, l1 + 5, j2 + 7);
            g1.drawLine(l1 + 5, j2 + 7, l1 + 11, j2 + 1);
            g1.setColor(255, 0, 0);
            g1.drawLine(l1 + 2, j2 + 5, l1 + 4, j2 + 7);
            g1.drawLine(l1 + 4, j2 + 7, l1 + 10, j2 + 1);
        }
        g1.setColor(((Integer)aobj[10]).intValue());
        g1.drawString((String)aobj[11], l1 + 12, i2, 36);
    }

    private void j(Graphics g1, Object aobj[])
    {
        int i1 = ((Integer)aobj[4]).intValue();
        int j1 = ((Integer)aobj[5]).intValue();
        Vector vector = (Vector)aobj[11];
        int k1 = ((Integer)aobj[2]).intValue();
        for(int l1 = 0; l1 < vector.size(); l1++)
        {
            if(j1 > p - super.f && j1 - k1 < (p - super.f) + l)
            {
                g1.setColor(((Integer)aobj[10]).intValue());
                pica.ui.a.a(g1, (Vector)vector.elementAt(l1), i1 + super.e, j1 + super.f, 36);
            }
            j1 = j1 + k1 + j;
        }

    }

    private void k(Graphics g1, Object aobj[])
    {
        int i1 = ((Integer)aobj[4]).intValue();
        int j1 = ((Integer)aobj[5]).intValue();
        int k1 = ((Integer)aobj[2]).intValue();
        int l1 = ((Integer)aobj[3]).intValue();
        int i2 = i1 + super.e;
        int j2 = j1 + super.f;
        boolean flag = ((Boolean)aobj[8]).booleanValue();
        g1.setColor(105, 105, 105);
        g1.drawRect(i2, j2 - k1, l1, k1);
        g1.setColor(250, 250, 250);
        g1.fillRect(i2, (j2 - k1) + 1, l1 - 1, k1 - 1);
        g1.setColor(105, 105, 105);
        g1.drawLine(i2, (j2 - k1) + 1, i2, j2 - 1);
        g1.setColor(220, 220, 220);
        g1.drawLine(i2 + 1, j2 - 1, (i2 + l1) - 1, j2 - 1);
        g1.drawLine(i2 + 2, j2 - 2, (i2 + l1) - 1, j2 - 2);
        g1.drawLine((i2 + l1) - 1, j2 - 1, (i2 + l1) - 1, (j2 - k1) + 1);
        g1.drawLine((i2 + l1) - 2, j2 - 1, (i2 + l1) - 2, (j2 - k1) + 2);
        g1.setColor(0, 0, 0);
        g1.drawString((String)aobj[11], i2 + 2, j2 - 2, 36);
        if(flag)
        {
            g1.setColor(128, 0, 0);
            g1.drawRect(i2, j2 - k1, l1, k1);
            g1.setColor(255, 0, 0);
            g1.drawRect(i2 - 1, j2 - k1 - 1, l1, k1);
        }
    }

    private static void a(Graphics g1, int i1, int j1, int k1, int l1, byte byte0, boolean flag)
    {
        g1.setColor(105, 105, 105);
        g1.drawRect(i1, j1, k1, l1);
        g1.setColor(220, 220, 220);
        g1.drawLine(i1 + 1, j1 + 1, (i1 + k1) - 2, j1 + 1);
        g1.drawLine(i1 + 1, j1 + 1, i1 + 1, (j1 + l1) - 2);
        if(byte0 == 7)
        {
            int i2 = (i1 + k1) - l1;
            g1.setColor(250, 250, 250);
            g1.fillRect(i2, j1 + 1, l1 - 1, l1 - 1);
            g1.setColor(105, 105, 105);
            g1.drawLine(i2, j1 + 1, i2, (j1 + l1) - 1);
            g1.setColor(220, 220, 220);
            g1.drawLine(i2 + 1, (j1 + l1) - 1, (i1 + k1) - 1, (j1 + l1) - 1);
            g1.drawLine(i2 + 2, (j1 + l1) - 2, (i1 + k1) - 1, (j1 + l1) - 2);
            g1.drawLine((i1 + k1) - 1, (j1 + l1) - 1, (i1 + k1) - 1, j1 + 1);
            g1.drawLine((i1 + k1) - 2, (j1 + l1) - 1, (i1 + k1) - 2, j1 + 2);
        }
        if(flag)
        {
            g1.setColor(128, 0, 0);
            g1.drawRect(i1, j1, k1, l1);
            g1.setColor(255, 0, 0);
            g1.drawRect(i1 - 1, j1 - 1, k1, l1);
        }
    }

    public final synchronized void a()
    {
        int i1 = 0;
        int j1 = 0;
        int k1 = k;
        int l1 = j;
        for(int i2 = 0; i2 < w.size(); i2++)
        {
            Object aobj[];
            if(((Byte)(aobj = (Object[])w.elementAt(i2))[0]).byteValue() == 5)
            {
                i1++;
                if(k1 == k)
                {
                    l1 = l1 + B.getHeight() + j;
                } else
                {
                    k1 = k;
                    l1 += j;
                }
                aobj[4] = new Integer(k1);
                aobj[5] = new Integer(l1);
                j1 = 0;
                continue;
            }
            if(k1 != k && k1 + ((Integer)aobj[3]).intValue() > super.g)
            {
                i1++;
                k1 = k;
                aobj[4] = new Integer(k1);
                j1 = ((Integer)aobj[2]).intValue();
                l1 = l1 + j1 + j;
                aobj[5] = new Integer(l1);
                aobj[1] = new Integer(i1);
                if(((Boolean)aobj[6]).booleanValue())
                {
                    k1 = k1 + ((Integer)aobj[3]).intValue() + k;
                } else
                {
                    k1 = super.g;
                    l1 += (((Integer)aobj[7]).intValue() - 1) * (((Integer)aobj[2]).intValue() + j);
                }
                continue;
            }
            if(((Integer)aobj[2]).intValue() > j1)
            {
                l1 = (l1 - j1) + ((Integer)aobj[2]).intValue();
                j1 = ((Integer)aobj[2]).intValue();
                Object aobj2[];
                for(int j2 = i2 - 1; j2 > 0 && ((Integer)(aobj2 = (Object[])w.elementAt(j2))[1]).intValue() == i1; j2--)
                    aobj2[5] = new Integer(l1);

            }
            aobj[4] = new Integer(k1);
            aobj[5] = new Integer(l1);
            aobj[1] = new Integer(i1);
            if(((Boolean)aobj[6]).booleanValue())
            {
                k1 = k1 + ((Integer)aobj[3]).intValue() + k;
            } else
            {
                k1 = super.g;
                l1 += (((Integer)aobj[7]).intValue() - 1) * (((Integer)aobj[2]).intValue() + j);
            }
        }

        super.h = l1;
        if(super.a != null)
            super.a.a(17, new Integer[] {
                new Integer(super.h), new Integer(l)
            });
        if(x < 0 || x >= w.size())
            return;
        Object aobj1[];
        if((aobj1 = (Object[])w.elementAt(x)) == null)
            return;
        if(!((Boolean)aobj1[9]).booleanValue())
            x = -1;
    }

    public final synchronized void a(String s1, String s2, int i1, byte byte0, byte byte1, int j1, int k1)
    {
        Object aobj[];
        (aobj = new Object[14])[0] = new Byte(byte1);
        aobj[1] = new Integer(0);
        aobj[2] = new Integer(B.getHeight());
        aobj[6] = new Boolean(true);
        aobj[7] = new Integer(1);
        aobj[8] = new Boolean(false);
        aobj[9] = new Boolean(false);
        aobj[11] = s1;
        aobj[12] = s2;
        aobj[13] = new Byte(byte0);
        aobj[10] = new Integer(i1);
        aobj[4] = new Integer(j1);
        aobj[5] = new Integer(k1);
        if(byte1 == 4)
            aobj[3] = new Integer(super.g);
        else
        if(byte1 == 5)
        {
            aobj[3] = new Integer(super.g);
            aobj[2] = new Integer(0);
        } else
        if(byte1 == 9)
        {
            int l1 = B.stringWidth(s1);
            aobj[3] = new Integer(l1);
            aobj[11] = pica.ui.a.a(s1, super.g - 2 * k, B, false);
            int j2 = ((Vector)aobj[11]).size();
            System.out.println("lnum: " + j2);
            if(j2 > 1)
                aobj[6] = new Boolean(false);
            else
                aobj[6] = new Boolean(true);
            aobj[7] = new Integer(j2);
            aobj[2] = new Integer(18);
        } else
        if(s1.equals("") || s1.length() == 0)
        {
            aobj[3] = new Integer(1);
        } else
        {
            int i2;
            if((i2 = B.stringWidth(s1)) > super.g)
            {
                aobj[3] = new Integer(i2);
                aobj[6] = new Boolean(false);
                aobj[11] = pica.ui.f.a(s1, super.g - 2 * k, B);
                aobj[7] = new Integer(((String[])aobj[11]).length);
            } else
            {
                aobj[3] = new Integer(i2);
                aobj[7] = new Integer(1);
            }
            if(byte1 == 2)
                aobj[9] = new Boolean(true);
        }
        w.addElement(((Object) (aobj)));
        if(k1 >= super.h)
            super.h = k1 + j;
    }

    public final synchronized void a(int i1, int j1, int k1, Image image, int l1, int i2)
    {
        Object aobj[];
        (aobj = new Object[13])[0] = new Byte((byte)3);
        aobj[1] = new Integer(0);
        aobj[3] = new Integer(i1);
        aobj[2] = new Integer(j1);
        aobj[6] = new Boolean(true);
        aobj[7] = new Integer(1);
        aobj[8] = new Boolean(false);
        aobj[9] = new Boolean(false);
        aobj[11] = image;
        aobj[12] = new Integer(k1);
        aobj[4] = new Integer(l1);
        aobj[5] = new Integer(i2);
        w.addElement(((Object) (aobj)));
        if(i2 > super.h)
            super.h = i2 + j;
    }

    public final synchronized void a(int i1, Image image)
    {
        for(int j1 = 0; j1 < w.size(); j1++)
        {
            Object aobj[];
            if(((Byte)(aobj = (Object[])w.elementAt(j1))[0]).byteValue() == 3 && ((Integer)aobj[12]).intValue() == i1)
            {
                aobj[11] = image;
                aobj[3] = new Integer(image.getWidth());
                aobj[2] = new Integer(image.getHeight());
                a();
            }
        }

    }

    public final synchronized void a(String s1, String s2, String s3, int i1, int j1, int k1, int l1, 
            int i2, int j2, int k2)
    {
        Object aobj[];
        (aobj = new Object[20])[0] = new Byte((byte)6);
        aobj[1] = new Integer(0);
        aobj[3] = new Integer(super.g);
        aobj[2] = new Integer(B.getHeight() + 5);
        aobj[6] = new Boolean(true);
        aobj[7] = new Integer(1);
        aobj[8] = new Boolean(false);
        aobj[9] = new Boolean(true);
        aobj[10] = new Integer(i2);
        aobj[11] = s1;
        aobj[15] = s2;
        aobj[4] = new Integer(j2);
        aobj[5] = new Integer(k2);
        if(s3 != null && s3.length() > i1)
            aobj[12] = s3.substring(0, i1);
        else
            aobj[12] = s3;
        aobj[16] = aobj[12];
        aobj[17] = new Integer(i1);
        aobj[18] = new Integer(j1);
        aobj[13] = new Integer(k1);
        aobj[14] = new Integer(l1);
        int l2;
        if((l2 = B.stringWidth(s1) + 5) + k1 > super.g - k)
        {
            aobj[6] = new Boolean(false);
            aobj[7] = new Integer(2);
        } else
        {
            aobj[6] = new Boolean(true);
            aobj[7] = new Integer(1);
        }
        w.addElement(((Object) (aobj)));
        if(k2 > super.h)
            super.h = k2 + j;
    }

    public final synchronized void a(String s1, boolean flag, int i1, int j1, int k1)
    {
        Object aobj[];
        (aobj = new Object[18])[0] = new Byte((byte)8);
        aobj[1] = new Integer(0);
        aobj[3] = new Integer(super.g);
        aobj[2] = new Integer(B.getHeight() + 5);
        aobj[6] = new Boolean(true);
        aobj[7] = new Integer(1);
        aobj[8] = new Boolean(false);
        aobj[9] = new Boolean(true);
        aobj[10] = new Integer(i1);
        aobj[11] = s1;
        aobj[17] = new Boolean(flag);
        aobj[4] = new Integer(j1);
        aobj[5] = new Integer(k1);
        w.addElement(((Object) (aobj)));
        if(k1 > super.h)
            super.h = k1 + j;
    }

    public final synchronized void a(String s1, String s2, String s3, String as[], Image aimage[], String as1[], int i1, 
            int j1, int k1, int l1)
    {
        Object aobj[];
        (aobj = new Object[21])[0] = new Byte((byte)7);
        aobj[1] = new Integer(0);
        aobj[6] = new Boolean(true);
        aobj[7] = new Integer(1);
        aobj[8] = new Boolean(false);
        aobj[9] = new Boolean(true);
        aobj[10] = new Integer(j1);
        aobj[11] = s1;
        aobj[15] = s2;
        aobj[16] = s3;
        aobj[19] = as1;
        aobj[14] = new Integer(i1);
        aobj[17] = new List(s1, 1, as, aimage);
        ((List)aobj[17]).addCommand(new Command("\u786E\u8BA4", 4, 1));
        ((List)aobj[17]).addCommand(new Command("\u53D6\u6D88", 2, 0));
        ((List)aobj[17]).setCommandListener(this);
        aobj[4] = new Integer(k1);
        aobj[5] = new Integer(l1);
        int i2 = 0;
        int j2 = 0;
        if(s3 != null)
        {
            for(int k2 = 0; k2 < as1.length; k2++)
            {
                if(s3.equals(as1[k2]))
                    i2 = k2;
                if(B.stringWidth(as[k2]) + 18 + 5 > j2)
                    j2 = B.stringWidth(as[k2]) + 18 + 5;
            }

        } else
        {
            j2 = super.g;
        }
        ((List)aobj[17]).setSelectedIndex(i2, true);
        aobj[13] = new Integer(j2);
        aobj[3] = new Integer(super.g);
        if(aimage != null)
            aobj[2] = new Integer(aimage[0].getHeight());
        else
            aobj[2] = new Integer(B.getHeight() + 5);
        int l2;
        if((l2 = B.stringWidth(s1) + 5) + j2 > super.g - k)
        {
            aobj[6] = new Boolean(false);
            aobj[7] = new Integer(2);
        }
        w.addElement(((Object) (aobj)));
        if(l1 > super.h)
            super.h = l1 + j;
    }

    public final synchronized void a(String s1, int i1, String s2, int j1, int k1, int l1)
    {
        Object aobj[];
        (aobj = new Object[14])[0] = new Byte((byte)16);
        aobj[1] = new Integer(0);
        aobj[6] = new Boolean(true);
        aobj[7] = new Integer(1);
        aobj[8] = new Boolean(false);
        aobj[9] = new Boolean(true);
        aobj[10] = new Integer(j1);
        aobj[3] = new Integer(B.stringWidth(s1) + 5);
        aobj[2] = new Integer(B.getHeight() + 5);
        aobj[11] = s1;
        aobj[12] = new Integer(i1);
        aobj[13] = s2;
        aobj[4] = new Integer(k1);
        aobj[5] = new Integer(l1);
        w.addElement(((Object) (aobj)));
        if(l1 > super.h)
            super.h = l1 + j;
    }

    protected final boolean a(byte byte0, int i1)
    {
        if(F != 1)
            return true;
        switch(byte0)
        {
        case 0: // '\0'
            h(i1);
            break;

        case 2: // '\002'
            q();
            break;
        }
        return true;
    }

    private void m()
    {
        super.f += l;
        if(p - super.f < 0)
            super.f = p;
    }

    private void n()
    {
        super.f -= l;
        if(p - super.f > super.h - l)
            super.f = l - super.h;
    }

    protected final boolean a(byte byte0, int i1, int j1)
    {
        if(byte0 == 0)
            return a(i1, j1);
        if(byte0 == 1)
            return g(j1);
        if(byte0 == 2)
            return o();
        else
            return false;
    }

    private boolean g(int i1)
    {
        boolean flag = false;
        if(M)
        {
            int j1 = l / (super.h / 14);
            if(i1 > N)
            {
                if(i1 >= O + j1 && p - super.f < super.h - l)
                {
                    super.f -= 14;
                    O = (short)i1;
                    if(super.a != null)
                        super.a.a(18, new Integer(p - super.f));
                }
            } else
            if(i1 <= O - j1 && p - super.f > 0)
            {
                super.f += 14;
                O = (short)i1;
                if(super.a != null)
                    super.a.a(18, new Integer(p - super.f));
            }
            N = (short)i1;
            flag = true;
        }
        return flag;
    }

    private boolean o()
    {
        N = 0;
        O = 0;
        M = false;
        return true;
    }

    private boolean a(int i1, int j1)
    {
        boolean flag = false;
        if(i1 >= super.g)
        {
            if(pica.ui.f.a(i1, j1, n, p, 10, 10))
            {
                m();
                if(super.a != null)
                    super.a.a(18, new Integer(p - super.f));
            } else
            if(pica.ui.f.a(i1, j1, n, (p + l) - 10, 10, 10))
            {
                n();
                if(super.a != null)
                    super.a.a(18, new Integer(p - super.f));
            } else
            {
                M = true;
                N = (short)j1;
                O = (short)j1;
                flag = true;
            }
        } else
        {
            int k1 = 0;
            do
            {
                if(k1 >= w.size())
                    break;
                Object aobj[] = (Object[])w.elementAt(k1);
                int l1 = 0;
                int i2 = 0;
                int j2 = 0;
                int k2 = 0;
                byte byte0;
                if((byte0 = ((Byte)aobj[0]).byteValue()) == 2)
                {
                    if(((Boolean)aobj[6]).booleanValue())
                    {
                        j2 = B.stringWidth((String)aobj[11]);
                        k2 = ((Integer)aobj[2]).intValue();
                        l1 = ((Integer)aobj[4]).intValue() + super.e;
                        i2 = (((Integer)aobj[5]).intValue() + super.f) - k2;
                    } else
                    {
                        String as[] = (String[])aobj[11];
                        j2 = 0;
                        for(int l2 = 0; l2 < as.length; l2++)
                            j2 = Math.max(B.stringWidth(as[l2]), j2);

                        k2 = ((Integer)aobj[2]).intValue();
                        l1 = ((Integer)aobj[4]).intValue() + super.e;
                        i2 = (((Integer)aobj[5]).intValue() + super.f) - k2;
                    }
                } else
                if(byte0 == 6)
                {
                    k2 = ((Integer)aobj[2]).intValue();
                    j2 = ((Integer)aobj[13]).intValue();
                    l1 = ((Integer)aobj[4]).intValue() + super.e;
                    i2 = (((Integer)aobj[5]).intValue() + super.f) - k2;
                    String s1;
                    int i3;
                    if((s1 = (String)aobj[11]).length() == 0)
                        i3 = 0;
                    else
                        i3 = B.stringWidth(s1) + 5;
                    if(!((Boolean)aobj[6]).booleanValue())
                        i2 += k2;
                    else
                        l1 += i3;
                } else
                if(byte0 == 7)
                {
                    k2 = ((Integer)aobj[2]).intValue();
                    j2 = ((Integer)aobj[13]).intValue();
                    l1 = ((Integer)aobj[4]).intValue() + super.e;
                    i2 = (((Integer)aobj[5]).intValue() + super.f) - k2;
                    String s2;
                    int j3;
                    if((s2 = (String)aobj[11]).length() == 0)
                        j3 = 0;
                    else
                        j3 = B.stringWidth(s2) + 5;
                    if(!((Boolean)aobj[6]).booleanValue())
                        i2 += k2;
                    else
                        l1 += j3;
                } else
                if(byte0 == 8)
                {
                    k2 = ((Integer)aobj[2]).intValue();
                    l1 = ((Integer)aobj[4]).intValue() + super.e;
                    i2 = (((Integer)aobj[5]).intValue() + super.f) - k2 / 2 - 4;
                    j2 = k2;
                } else
                if(byte0 == 16)
                {
                    k2 = ((Integer)aobj[2]).intValue();
                    j2 = ((Integer)aobj[3]).intValue();
                    l1 = ((Integer)aobj[4]).intValue() + super.e;
                    i2 = (((Integer)aobj[5]).intValue() + super.f) - k2;
                } else
                {
                    byte0 = -1;
                }
                if(byte0 != -1 && pica.ui.f.a(i1, j1, l1, i2, j2, k2))
                {
                    x = k1;
                    p();
                    r();
                    flag = true;
                    break;
                }
                k1++;
            } while(true);
        }
        return flag;
    }

    private void p()
    {
        super.b.repaint();
        super.b.serviceRepaints();
    }

    private void h(int i1)
    {
        switch(i1)
        {
        default:
            break;

        case -1: 
        case 50: // '2'
            s();
            G = i1;
            H = true;
            if(super.a != null)
            {
                super.a.a(18, new Integer(p - super.f));
                return;
            }
            break;

        case -2: 
        case 56: // '8'
            t();
            G = i1;
            H = true;
            if(super.a != null)
            {
                System.out.println("viewY = " + p);
                super.a.a(18, new Integer(p - super.f));
                return;
            }
            break;

        case -5: 
        case 53: // '5'
            r();
            return;

        case 48: // '0'
            Alert alert;
            (alert = new Alert("", h.h.toString(), null, AlertType.INFO)).setTimeout(-2);
            h.d.setCurrent(alert);
            return;

        case 49: // '1'
            m();
            if(super.a != null)
            {
                super.a.a(18, new Integer(p - super.f));
                return;
            }
            break;

        case 55: // '7'
            n();
            if(super.a != null)
                super.a.a(18, new Integer(p - super.f));
            break;
        }
    }

    private void q()
    {
        H = false;
        I = 5;
    }

    private void r()
    {
        if(x < 0 || x >= w.size())
            return;
        Object aobj[];
        switch(((Byte)(aobj = (Object[])w.elementAt(x))[0]).byteValue())
        {
        case 6: // '\006'
            TextBox textbox;
            (textbox = new TextBox((String)aobj[11], (String)aobj[12], ((Integer)aobj[17]).intValue(), ((Integer)aobj[18]).intValue())).addCommand(new Command("\u786E\u8BA4", 4, 1));
            textbox.addCommand(new Command("\u53D6\u6D88", 2, 0));
            textbox.setCommandListener(this);
            aobj[19] = textbox;
            C = pica.ui.h.d().getCurrent();
            pica.ui.h.d().setCurrent(textbox);
            return;

        case 8: // '\b'
            aobj[17] = new Boolean(!((Boolean)aobj[17]).booleanValue());
            return;

        case 7: // '\007'
            C = pica.ui.h.d().getCurrent();
            pica.ui.h.d().setCurrent((List)aobj[17]);
            return;

        case 16: // '\020'
            Vector vector = new Vector();
            for(int i1 = 0; i1 < w.size(); i1++)
            {
                Object aobj2[];
                if((((Byte)(aobj2 = (Object[])w.elementAt(i1))[0]).byteValue() == 7 || ((Byte)aobj2[0]).byteValue() == 6) && ((Integer)aobj[12]).intValue() == ((Integer)aobj2[14]).intValue())
                {
                    String as[] = {
                        (String)aobj2[15], (String)aobj2[16]
                    };
                    vector.addElement(as);
                }
            }

            Object aobj1[] = {
                aobj[13], vector
            };
            super.a.a(14, ((Object) (aobj1)));
            return;

        case 2: // '\002'
            String s1 = (String)aobj[12];
            super.a.a(13, s1);
            // fall through

        case 3: // '\003'
        case 4: // '\004'
        case 5: // '\005'
        case 9: // '\t'
        case 10: // '\n'
        case 11: // '\013'
        case 12: // '\f'
        case 13: // '\r'
        case 14: // '\016'
        case 15: // '\017'
        default:
            return;
        }
    }

    private void s()
    {
        if(w == null)
            return;
        Object obj = null;
        if(w.size() == 0)
        {
            x = -1;
            return;
        }
        if(x != -1)
        {
            Object aobj[];
            if(((Integer)(aobj = (Object[])w.elementAt(x))[5]).intValue() - ((Integer)aobj[2]).intValue() < p - super.f)
            {
                super.f = super.f + 20;
                return;
            }
            ((Byte)aobj[0]).byteValue();
        }
        if(x == 0)
            return;
        for(int i1 = x != -1 ? --x : 0; i1 >= 0; i1--)
        {
            Object aobj1[];
            if(((Integer)(aobj1 = (Object[])w.elementAt(i1))[5]).intValue() - ((Integer)aobj1[2]).intValue() < p - super.f)
            {
                super.f = super.f + 20;
                if(x != -1)
                    x++;
                return;
            }
            if(((Boolean)aobj1[9]).booleanValue())
            {
                x = i1;
                return;
            }
        }

        if(x != -1)
            x++;
    }

    private void t()
    {
        if(w == null)
            return;
        Object obj = null;
        if(w.size() == 0)
        {
            x = -1;
            return;
        }
        if(x != -1)
        {
            Object aobj[];
            if(((Integer)(aobj = (Object[])w.elementAt(x))[5]).intValue() + (((Integer)aobj[7]).intValue() - 1) * (((Integer)aobj[2]).intValue() + j) > (p - super.f) + l)
            {
                super.f = super.f - 20;
                return;
            }
            ((Byte)aobj[0]).byteValue();
        }
        if(x == w.size() - 1)
            return;
        for(int i1 = ++x; i1 < w.size(); i1++)
        {
            Object aobj1[];
            if(((Integer)(aobj1 = (Object[])w.elementAt(i1))[5]).intValue() + (((Integer)aobj1[7]).intValue() - 1) * (((Integer)aobj1[2]).intValue() + j) > (p - super.f) + l)
            {
                super.f = super.f - 20;
                x--;
                return;
            }
            if(((Boolean)aobj1[9]).booleanValue())
            {
                x = i1;
                return;
            }
        }

        x--;
    }

    public final void b()
    {
        super.f = (p + l) - super.h;
    }

    public final void commandAction(Command command, Displayable displayable)
    {
        Object aobj[] = (Object[])w.elementAt(x);
        if(command.getLabel() == "\u786E\u8BA4")
            if(((Byte)aobj[0]).byteValue() == 6)
            {
                aobj[12] = ((TextBox)aobj[19]).getString().trim();
                if(((TextBox)aobj[19]).getString().length() > ((Integer)aobj[17]).intValue())
                    aobj[12] = ((String)aobj[12]).substring(0, ((Integer)aobj[17]).intValue());
                aobj[16] = aobj[12];
                aobj[19] = null;
            } else
            if(((Byte)aobj[0]).byteValue() == 7)
            {
                int i1 = ((List)aobj[17]).getSelectedIndex();
                aobj[12] = ((List)aobj[17]).getString(i1);
                if(aobj[19] != null)
                    aobj[16] = ((String[])aobj[19])[i1];
                int ai[] = {
                    x, i1
                };
                if(super.a != null)
                    super.a.a(11, ai);
            }
        pica.ui.h.d().setCurrent(C);
    }

    public final void a(String s1)
    {
        J = s1;
    }

    public final String c()
    {
        return J;
    }

    public final int d()
    {
        return o;
    }

    public final int e()
    {
        return p;
    }

    public final int f()
    {
        return n;
    }

    public final int g()
    {
        return l;
    }

    public final int h()
    {
        return w.size();
    }

    public final void i()
    {
        L = true;
        K = 0;
    }

    public final void j()
    {
        L = false;
    }

    public final void e(int i1)
    {
        K = i1;
    }

    public final void f(int i1)
    {
        w.removeElementAt(i1);
    }

    private void a(Graphics g1, int i1)
    {
        if(L)
        {
            int j1 = B.getHeight();
            g1.setColor(250, 250, 210);
            g1.fillRect(o, (p + l) - j1, n, j1);
            g1.setColor(0, 0, 128);
            g1.fillRect(o, (p + l) - j1, i1, j1);
            g1.setColor(255, 0, 0);
            g1.drawString("\u8BF7\u7A0D\u5019...", n / 2, (p + l) - j1, 17);
        }
    }

    public final synchronized void k()
    {
        w.removeAllElements();
        super.e = o;
        super.f = p;
        x = -1;
        y = 0;
    }

    private static int j = 4;
    private static int k = 4;
    private int l;
    private int m;
    private int n;
    private int o;
    private int p;
    private int q;
    private int r;
    private int s;
    private int t;
    private int u;
    private int v;
    private Vector w;
    private int x;
    private int y;
    private int z;
    private static int A = 10;
    private Font B;
    private Displayable C;
    private int D;
    private Image E;
    private byte F;
    private int G;
    private boolean H;
    private int I;
    private String J;
    private int K;
    private boolean L;
    public static Image i = null;
    private boolean M;
    private short N;
    private short O;

}
